package com.cadre.web.controller.officer;

import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON;
import com.cadre.common.exception.CadreException;
import com.cadre.common.utils.Office2PDF;
import com.cadre.common.utils.R;
import com.cadre.common.utils.common.DateUtils;
import com.cadre.common.utils.oldutil.DateUtil;
import com.cadre.common.utils.oldutil.*;
import com.cadre.system.domain.officer.*;
import com.cadre.system.service.*;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

@RequestMapping({"/report"})
@Api(value = "报表接口", tags = {"报表接口--成都"})
@Controller
/* loaded from: ReportController.class */
public class ReportController {
    @Value("${ISSHOWZHUANYE}")
    private Boolean isShow;
    @Autowired
    private ReportService reportService;
    @Autowired
    private ReportConfig config;
    @Autowired
    private DPersontagService dPersontagService;
    @Autowired
    private PersonService personService;
    @Autowired
    private A01Service a01Service;
    @Autowired
    private PX_JGXXService PX_JGXXService;
    @Autowired
    private SysConfigService sysConfigService;
    private int MAX_COLUMN_LEN = 14;
    @Value("${ModelFilePath}")
    private String ModelFilePath;
    private static final int rowNum = 9;
    private static final int len = 6;
    private static final int firstTitle = 1;
    private static final int firstData = 3;

    @PostMapping({"/person/list"})
    @ApiImplicitParam(name = "ids", value = "单位id", required = true, paramType = "query", defaultValue = "1")
    @ApiOperation("干部名册：干部名册列表")
    @ResponseBody
    public ResultVO selectPersonListById(String ids) {
        try {
            return this.reportService.selectPersonListByIdNoUnit(ids);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVOUtil.error(ResultEnum.ERROR);
        }
    }

    @PostMapping({"/person/listGroupByUnit"})
    @ApiImplicitParam(name = "ids", value = "单位id", required = true, paramType = "query", defaultValue = "1")
    @ApiOperation("干部名册：干部名册列表,根据单位分组")
    @ResponseBody
    public ResultVO listGroupByUnit(String ids) {
        try {
            return this.reportService.listGroupByUnit(ids);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVOUtil.error(ResultEnum.ERROR);
        }
    }

    @PostMapping({"/person/listbyMap"})
    @ApiImplicitParams({@ApiImplicitParam(name = "ids", value = "用户名", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "orderpid", value = "单位id", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "ageStart1", value = "年龄开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "ageEnd1", value = "年龄结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "sex", value = "女", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "nation", value = "少", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "politics", value = "非", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0198Start", value = "职务层次开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0198End", value = "职务层次结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0179Start", value = "职级开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0179End", value = "职级结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0180Start", value = "任现职务层次年限开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0180End", value = "任现职务层次年限结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0185Start", value = "任现职年限开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0185End", value = "任现职年限结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0142Start", value = "任现职级年限开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0142End", value = "任现职级年限结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0405Start", value = "学历开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0405End", value = "学历结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0449", value = "全日制学历", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "a0181", value = "干部类型", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0138Start", value = "参加工作开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0138End", value = "参加工作结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0184Start", value = "入党时间开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "A0184End", value = "入党时间结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "a0106Start", value = "出生年月开始", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "a0106End", value = "出生年月结束", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "a1940", value = "领导职务类型", dataType = "string", paramType = "query")})
    @ApiOperation("干部名册：干部花名册列表byMap")
    @ResponseBody
    public ResultVO selectPersonListByMap(String ids, String orderpid, String ageStart1, String ageEnd1, String sex, String nation, String politics, String A0198Start, String A0198End, String A0179Start, String A0179End, String A0180Start, String A0180End, String A0185Start, String A0185End, String A0142Start, String A0142End, String A0405Start, String A0405End, String A0449, String a0181, String A0138Start, String A0138End, String A0184Start, String A0184End, String a0106Start, String a0106End, String a1940) {
        try {
            Map<String, Object> map = new HashMap<>();
            if (ids != null) {
                map.put("ids", ids);
            }
            if (orderpid != null) {
                map.put("orderpid", orderpid);
            }
            if (ageStart1 != null) {
                map.put("ageStart1", ageStart1);
            }
            if (ageEnd1 != null) {
                map.put("ageEnd1", ageEnd1);
            }
            if (nation != null) {
                map.put("nation", nation);
            }
            if (politics != null) {
                map.put("politics", politics);
            }
            if (A0198Start != null) {
                map.put("A0198Start", A0198Start);
            }
            if (A0198End != null) {
                map.put("A0198End", A0198End);
            }
            if (A0179Start != null) {
                map.put("A0179Start", A0179Start);
            }
            if (A0179End != null) {
                map.put("A0179End", A0179End);
            }
            if (A0180Start != null) {
                map.put("A0180Start", A0180Start);
            }
            if (A0180End != null) {
                map.put("A0180End", A0180End);
            }
            if (A0180Start != null) {
                map.put("A0185Start", A0185Start);
            }
            if (A0180End != null) {
                map.put("A0185End", A0185End);
            }
            if (A0142Start != null) {
                map.put("A0142Start", A0142Start);
            }
            if (A0142End != null) {
                map.put("A0142End", A0142End);
            }
            if (A0405Start != null) {
                map.put("A0405Start", A0405Start);
            }
            if (A0405End != null) {
                map.put("A0405End", A0405End);
            }
            if (A0449 != null) {
                map.put("A0449", A0449);
            }
            if (sex != null) {
                map.put("sex", sex);
            }
            if (a0181 != null) {
                map.put("a0181", a0181);
            }
            if (A0138Start != null) {
                map.put("A0138Start", A0138Start);
            }
            if (A0138End != null) {
                map.put("A0138End", A0138End);
            }
            if (A0184Start != null) {
                map.put("A0184Start", A0184Start);
            }
            if (A0184End != null) {
                map.put("A0184End", A0184End);
            }
            if (a0106Start != null) {
                map.put("a0106Start", a0106Start);
            }
            if (a0106End != null) {
                map.put("a0106End", a0106End);
            }
            if (a1940 != null) {
                map.put("a1940", a1940);
            }
            return this.reportService.selectPersonListByMap(map);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVOUtil.error(ResultEnum.ERROR);
        }
    }

    @PostMapping({"/person/listForName"})
    @ApiOperation("干部名册：根据姓名查询干部")
    public R listForName(@RequestParam Map<String, Object> map) {
        return R.ok().put("page", (Object) this.reportService.selectPersonListForName(map));
    }

    @PostMapping({"/person/cadreExcel"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("智搜功能：干部列表excel导出")
    @ResponseBody
    public void exportCadreExcel(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        List<A01> list = this.dPersontagService.exprotSearch(params);
        String[] fields = {"a0101", "a0183", "a0185", "a0142", "aa01", "a0108", "a0138", "a0184a", "a0187", "a0188", "a0190", "a0191", "a0177a", "a0195", "remark"};
        String[] fieldNames = {"姓名", "职务", "任现职时间", "任现职级时间", "出生年月", "籍贯", "工作时间", "入党时间", "全日制学历", "毕业院校及专业", "在职学历", "毕业院校及专业", "主要经历", "近三年考核", "备注"};
        List flowidList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            flowidList.add(list.get(i).getFlowid());
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i2 = 0; i2 < fields.length; i2++) {
            if (!"flowid".equals(fields[i2]) && !"a0180".equals(fields[i2])) {
                objects2.add(fields[i2]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFields(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i3 = 0; i3 < fieldNames.length; i3++) {
            if (!"flowid".equals(fieldNames[i3]) && !"任现职务层次时间".equals(fieldNames[i3])) {
                objects.add(fieldNames[i3]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields3(data2, (String[]) objects.toArray(new String[objects.size()])), response, "干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelForIds"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：干部列表excel导出")
    @ResponseBody
    public void cadreExportExcelForIds(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("flowids").split(",");
        new ArrayList();
        String[] fields = {"a0101", "a0183", "a0185", "a0142", "aa01", "a0108", "a0138", "a0184a", "a0187", "a0188", "a0190", "a0191", "a0177a", "a0195", "remark"};
        String[] fieldNames = {"姓名", "职务", "任现职时间", "任现职级时间", "出生年月", "籍贯", "工作时间", "入党时间", "全日制学历", "毕业院校及专业", "在职学历", "毕业院校及专业", "主要经历", "近三年考核", "备注"};
        List flowidList = new ArrayList();
        for (String str : flowids) {
            flowidList.add(str);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFields(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields3(data2, (String[]) objects.toArray(new String[objects.size()])), response, "干部列表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：干部名册excel导出")
    @ResponseBody
    public void cadreExportExcelNew(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = params.get("fieldStr").split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFields(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields3(data2, (String[]) objects.toArray(new String[objects.size()])), response, "干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew1"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：部委会上会表excel导出")
    @ResponseBody
    public void cadreExportExcelNew1(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,xblank1,xblank2,a0105,aa01,a0108,a0138,a0184a,a0187,a0188,xblank3,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsShuji(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields1(data2, (String[]) objects.toArray(new String[objects.size()])), response, "部委会上会表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew22"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：常委会上会表excel导出")
    @ResponseBody
    public void cadreExportExcelNew22(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,xblank1,xblank2,a0105,aa01,a0108,a0138,a0184a,a0187,a0188,xblank3,xblank4,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsChangweihui(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields22(data2, (String[]) objects.toArray(new String[objects.size()])), response, "常委会上会表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew3"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：常委会表决票excel导出")
    @ResponseBody
    public void cadreExportExcelNew3(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,xblank1,xblank2,xblank3,xblank4,xblank5".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsChangweiHuizong(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFieldsHuizong(data2, (String[]) objects.toArray(new String[objects.size()]), "/xls/xianji/常委会表决票.xlsx", "对拟任、免职人员，在表决意见栏内同意的划“○”,不同意的划“×”,弃权的不划任何符号。"), response, "常委会表决票");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew4"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：常委会汇总表excel导出")
    @ResponseBody
    public void cadreExportExcelNew4(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,xblank1,xblank2,xblank3,xblank4,xblank5".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsChangweiHuizong(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFieldsHuizong(data2, (String[]) objects.toArray(new String[objects.size()]), "/xls/xianji/常委会表汇总表.xlsx", null), response, "常委会汇总表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew5"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：县级干部名册excel导出")
    @ResponseBody
    public void cadreExportExcelNew5(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,a0105,aa01,a0138,a0184a,xblank1,xblank2,a0185,a0142,a0187,a0188,a0190,a0191,a0108,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsXianji(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields5(data2, (String[]) objects.toArray(new String[objects.size()])), response, "县级干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew5_1"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：县级干部名册excel导出")
    @ResponseBody
    public void cadreExportExcelNew5_1(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,a0105,aa01,a0138,a0184a,xblank1,xblank2,a0185,a0142,a0187,a0188,a0190,a0191,a0108,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList1 = Lists.newArrayList();
        List<CadreData> dataList2 = Lists.newArrayList();
        List<PersonVO> personList1 = this.reportService.getListByIdListXj(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList1);
        cadreData.setName("全部干部");
        dataList1.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsXianji_1(dataList1, StringUtils.join(objects2, ",")), 99999);
        List<PersonVO> personList2 = this.reportService.getListByIdListKj(flowidList);
        CadreData cadreData2 = new CadreData();
        cadreData2.setList(personList2);
        cadreData2.setName("全部干部");
        dataList2.add(cadreData2);
        List<String> objects22 = Lists.newArrayList();
        for (int i2 = 0; i2 < fields.length; i2++) {
            if (!"flowid".equals(fields[i2]) && !"a0180".equals(fields[i2])) {
                objects22.add(fields[i2]);
            }
        }
        List<CadreData> data2_1 = getData2(getDataByFieldsKeji_1(dataList2, StringUtils.join(objects22, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i3 = 0; i3 < fieldNames.length; i3++) {
            if (!"flowid".equals(fieldNames[i3]) && !"任现职务层次时间".equals(fieldNames[i3])) {
                objects.add(fieldNames[i3]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields5_1(data2, data2_1, (String[]) objects.toArray(new String[objects.size()])), response, "县级干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew5_2"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：县级干部名册excel导出")
    @ResponseBody
    public void cadreExportExcelNew5_2(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,a0105,aa01,a0138,a0184a,xblank1,xblank2,a0185,a0142,a0187,a0188,a0190,a0191,a0108,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList1 = Lists.newArrayList();
        Lists.newArrayList();
        List<PersonVO> personList1 = this.reportService.getListByIdListXj1(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList1);
        cadreData.setName("全部干部");
        dataList1.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsXianji_1(dataList1, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields5_2(data2, (String[]) objects.toArray(new String[objects.size()])), response, "处级干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew5_3"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：科级干部名册excel导出")
    @ResponseBody
    public void cadreExportExcelNew5_3(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,a0105,aa01,a0138,a0184a,xblank1,xblank2,a0185,a0142,a0187,a0188,a0190,a0191,a0108,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        Lists.newArrayList();
        List<CadreData> dataList2 = Lists.newArrayList();
        List<PersonVO> personList2 = this.reportService.getListByIdListKj1(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList2);
        cadreData.setName("全部干部");
        dataList2.add(cadreData);
        Lists.newArrayList();
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2_1 = getData2(getDataByFieldsKeji_1(dataList2, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields5_3(data2_1, (String[]) objects.toArray(new String[objects.size()])), response, "科级干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew6"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：书记上会表excel导出")
    @ResponseBody
    public void cadreExportExcelNew6(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "a0101,a0183,xblank1,xblank2,a0105,aa01,a0108,a0138,a0184a,a0187,a0188,xblank3,remark".split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i]) && !"a0180".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsShuji(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields6(data2, (String[]) objects.toArray(new String[objects.size()])), response, "书记上会表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNewHBT"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：省环保厅花名册excel导出")
    @ResponseBody
    public void cadreExportExcelNewHBT(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = "NOX,CHUSHI,A0101,A0183,A0198,A0105,A0106,A0108,A0130,A0138,A0184A,A0187,A0189,A0188,A0190,A0191,A0202,A0203,A0180,A0142,A0177b,KAOHE3,KAOHE2,KAOHE1,AGE,ISJUN,A0107,A0186,A0152,A2601,A79STR".split(",");
        String[] fieldNames = "序号,处室,姓 名,现任职务,现任职级,性别,出生年月,籍贯,民族,参加工作时间,入党时间,学 历,全日制学历学位,全日制毕业时间院校及专业,在职学历学位,在职毕业时间院校及专业,调入机关时间,调入现处室时间,任现职务层次时间,任现职级时间,工  作  简  历,2019年度考核结果,2020年度考核结果,2021年度考核结果,年龄,是否军转干部,身份证号码,专业技术职务,熟悉专业有何特长,奖惩情况,家庭主要成员及重要社会关系".split(",");
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdListHBT(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (int i = 0; i < fields.length; i++) {
            if (!"flowid".equals(fields[i])) {
                objects2.add(fields[i]);
            }
        }
        List<CadreData> data2 = getData2(getDataByFieldsHBT(dataList, StringUtils.join(objects2, ",")), 99999);
        List<String> objects = Lists.newArrayList();
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            if (!"flowid".equals(fieldNames[i2]) && !"任现职务层次时间".equals(fieldNames[i2])) {
                objects.add(fieldNames[i2]);
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFieldsHBT(data2, (String[]) objects.toArray(new String[objects.size()])), response, "基础信息花名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    private List<CadreData> getData2(List<CadreData> data, int num) {
        List<CadreData> data2 = new ArrayList<>();
        for (CadreData datum : data) {
            List list = datum.getList();
            if (list == null) {
                return null;
            }
            int size = list.size();
            int i = size / num;
            if (i != 0) {
                for (int j = 0; j < i; j++) {
                    List ls = list.subList(j * num, (j + 1) * num);
                    CadreData cadreData = new CadreData();
                    cadreData.setList(ls);
                    cadreData.setName(datum.getName());
                    data2.add(cadreData);
                }
                if (i * num < size) {
                    List ls2 = list.subList(i * num, size);
                    CadreData cadreData2 = new CadreData();
                    cadreData2.setList(ls2);
                    cadreData2.setName(datum.getName());
                    data2.add(cadreData2);
                }
            } else {
                data2.add(datum);
            }
        }
        return data2;
    }

    @PostMapping({"/person/exportExcelContainUnitName"})
    @ApiOperation("人员管理-干部名册-导出：excel导出（包含单位名称）")
    @ResponseBody
    public void exportExcelContainUnitName(@RequestBody Map<String, String> params, HttpServletResponse response) {
        String flowids = params.get("ids");
        String[] fields = params.get("fieldStr").split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        if (StringUtils.isBlank(flowids)) {
            throw new CadreException(ResultEnum.EXPORT_DATA_IS_NULL);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = (List) this.reportService.selectPersonListById(flowids).getData();
        if (CollectionUtils.isEmpty(personList)) {
            throw new CadreException(ResultEnum.EXPORT_DATA_IS_NULL);
        }
        Map<String, List<PersonVO>> mapList = (Map) personList.stream().collect(Collectors.groupingBy(p -> {
            return p.getB01Id();
        }));
        for (String unitId : mapList.keySet()) {
            List<PersonVO> personVOS = mapList.get(unitId);
            CadreData cadreData = new CadreData();
            cadreData.setId(unitId);
            cadreData.setList(personVOS);
            cadreData.setName(personVOS.get(0).getB0101());
            dataList.add(cadreData);
        }
        try {
            PoiUtil.writeExcel(getWorkbookContainUnitName(getData2(getDataByFields(dataList, params.get("fieldStr").toString())), fields, fieldNames), response, "干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelNew2"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：人员管理excel导出")
    @ResponseBody
    public void cadreExportExcelNew2(@RequestBody Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("ids").split(",");
        String[] fields = {"a0101", "a0183", "a0185", "a0142", "aa01", "a0108", "a0138", "a0184a", "a0187", "a0188", "a0190", "a0191", "a0177a", "remark"};
        String[] fieldNames = {"姓名", "职务", "任现职时间", "任现职级时间", "出生年月", "籍贯", "工作时间", "入党时间", "全日制学历", "毕业院校及专业", "在职学历", "毕业院校及专业", "主要经历", "备注"};
        System.out.println("fieldStr:" + params.get("fieldStr"));
        List flowidList = new ArrayList();
        for (String id : flowids) {
            flowidList.add(id);
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList2(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (String str : fields) {
            objects2.add(str);
        }
        if (objects2.contains("a0106") && !objects2.contains("aa01")) {
            objects2.add("aa01");
        }
        List<CadreData> data = getDataByFields2(dataList, StringUtils.join(objects2, ","));
        ArrayList<String> objects = new ArrayList<>();
        Lists.newArrayList(new String[]{"性别", "名族", "编制", "身份", "出生", "健康", "全日", "专长", "熟悉", "主要", "管理", "人员", "编制类型", "身份证号", "出生地", "健康状况", "全日制学位", "熟悉领域", "民族", "主要特点及不足", "管理类别(省管、市管、县管、其他)", "人员id", "任现职务层次时间"});
        for (String str2 : fieldNames) {
            objects.add(str2);
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields3(data, (String[]) objects.toArray(new String[objects.size()])), response, "干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    private Workbook getWorkbookByFields3(List<CadreData> data2, String[] fieldNames) {
        String temPath = this.config.getExcelRenTmp();
        if (this.isShow.booleanValue()) {
            temPath = this.config.getExcelRenTmp();
        }
        Workbook wb = PoiUtil.createWorkbook(temPath);
        Sheet sheet = wb.getSheetAt(0);
        int size = data2.get(0).getList().size();
        if (size > len) {
            for (int i = 0; i < size - firstData; i++) {
                PoiUtil.copyRows(firstData, 4, 5 + i, sheet);
            }
        } else {
            for (int i2 = 0; i2 < len - size; i2++) {
                sheet.removeRow(sheet.getRow(8 - i2));
            }
        }
        int firstCellIndex = sheet.getRow(2).getFirstCellNum();
        int n = data2.size();
        for (int i3 = 0; i3 < n; i3++) {
            Row row = sheet.getRow(1 + (8 * i3));
            Double.valueOf(Math.floor(110.0d / ((double) (fieldNames.length == 0 ? 1 : fieldNames.length)))).intValue();
            if (i3 == 0) {
                row.getCell(0).setCellValue("");
            } else {
                row.getCell(0).setCellValue("");
            }
            CellStyle styleT = wb.createCellStyle();
            for (int i1 = 0; i1 < fieldNames.length; i1++) {
                Cell cellT = sheet.getRow(1 + (8 * i3) + 1).getCell(i1);
                cellT.setCellValue(fieldNames[i1].replace("\"", ""));
                if (i1 == 0) {
                    styleT = cellT.getCellStyle();
                } else {
                    cellT.setCellStyle(styleT);
                }
            }
            for (int i22 = fieldNames.length; i22 < 27; i22++) {
                Row rowT = sheet.getRow(1 + (8 * i3) + 1);
                Cell cellT2 = rowT.getCell(i22);
                cellT2.setCellValue("");
                rowT.removeCell(cellT2);
            }
            List list = data2.get(i3).getList();
            CellStyle styleC = wb.createCellStyle();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + (8 * i3) + j);
                boolean lastDataRow = false;
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i12 = 0; i12 < li.size(); i12++) {
                    Cell cc = rows.getCell(firstCellIndex + i12);
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i12);
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i12) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i12 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        short newsize = PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i12).toString(), oldsize);
                        if (oldsize > newsize) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(newsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(newsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i12).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
                try {
                    for (int i23 = fieldNames.length; i23 < 27; i23++) {
                        rows.removeCell(rows.getCell(i23));
                    }
                } catch (Exception e2) {
                }
            }
            for (int j1 = 0; j1 < 7; j1++) {
                try {
                    Row rowT2 = sheet.getRow(firstData + (8 * i3) + j1);
                    for (int i24 = fieldNames.length; i24 < 27; i24++) {
                        Cell cellT3 = rowT2.getCell(i24);
                        cellT3.setCellValue("");
                        rowT2.removeCell(cellT3);
                    }
                } catch (Exception e3) {
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields2(List<CadreData> data2, String[] fields, String[] fieldNames) {
        String temPath = this.config.getExcelRenTmp();
        if (this.isShow.booleanValue()) {
            temPath = this.config.getExcelRenTmp();
        }
        Workbook wb = PoiUtil.createWorkbook(temPath);
        Sheet sheet = wb.getSheetAt(0);
        if (data2.size() > 1) {
            int n = data2.size() - 1;
            for (int i = 0; i < n; i++) {
                PoiUtil.copyRows(1, rowNum, (i + 1) * 8, sheet);
            }
        }
        int firstCellIndex = sheet.getRow(2).getFirstCellNum();
        int n2 = data2.size();
        for (int i2 = 0; i2 < n2; i2++) {
            Row row = sheet.getRow(1 + (8 * i2));
            int width = Double.valueOf(Math.floor(110.0d / ((double) (fieldNames.length == 0 ? 1 : fieldNames.length)))).intValue();
            if (i2 == 0) {
                row.getCell(0).setCellValue("");
            } else {
                row.getCell(0).setCellValue("");
            }
            for (int i1 = 0; i1 < fieldNames.length; i1++) {
                sheet.getRow(1 + (8 * i2) + 1).getCell(i1).setCellValue(fieldNames[i1].replace("\"", ""));
                sheet.setColumnWidth(i1, width * 256);
            }
            for (int i22 = fieldNames.length; i22 < 26; i22++) {
                Row rowT = sheet.getRow(1 + (8 * i2) + 1);
                Cell cellT = rowT.getCell(i22);
                cellT.setCellValue("");
                rowT.removeCell(cellT);
            }
            List list = data2.get(i2).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + (8 * i2) + j);
                List li = (List) list.get(j);
                for (int i12 = 0; i12 < li.size(); i12++) {
                    Cell cc = rows.getCell(firstCellIndex + i12);
                    if (li.get(i12) != null) {
                        CellStyle style = cc.getCellStyle();
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        short newsize = PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i12).toString(), oldsize);
                        if (oldsize > newsize) {
                            CellStyle styleN = wb.createCellStyle();
                            styleN.cloneStyleFrom(style);
                            Font fontN = wb.createFont();
                            fontN.setBold(font.getBold());
                            fontN.setFontName(font.getFontName());
                            fontN.setFontHeightInPoints(newsize);
                            styleN.setFont(fontN);
                            cc.setCellStyle(styleN);
                        }
                        cc.setCellValue(li.get(i12).toString());
                    }
                }
                try {
                    for (int i23 = fieldNames.length; i23 < 26; i23++) {
                        rows.removeCell(rows.getCell(i23));
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            for (int j1 = 0; j1 < 7; j1++) {
                try {
                    Row rowT2 = sheet.getRow(firstData + (8 * i2) + j1);
                    for (int i24 = fieldNames.length; i24 < 26; i24++) {
                        Cell cellT2 = rowT2.getCell(i24);
                        cellT2.setCellValue("");
                        rowT2.removeCell(cellT2);
                    }
                } catch (Exception e) {
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields5(List<CadreData> data2, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/县级干部名册.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(2);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row2.getCell(firstCellIndex).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + j);
                if (rows == null) {
                    rows = sheet.createRow(firstData + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields5_1(List<CadreData> data2, List<CadreData> data2_1, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/县级干部名册1.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(2);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row2.getCell(firstCellIndex).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + j);
                if (rows == null) {
                    rows = sheet.createRow(firstData + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        Sheet sheet2 = wb.getSheetAt(1);
        data2_1.get(0).getList().size();
        Row row22 = sheet2.getRow(2);
        int firstCellIndex2 = row22.getFirstCellNum();
        CellStyle styleC2 = row22.getCell(firstCellIndex2).getCellStyle();
        for (int i2 = 0; i2 < data2_1.size(); i2++) {
            sheet2.getRow(1 + (8 * i2));
            List list2 = data2_1.get(i2).getList();
            int m2 = list2.size();
            for (int j2 = 0; j2 < m2; j2++) {
                Row rows2 = sheet2.getRow(firstData + j2);
                if (rows2 == null) {
                    rows2 = sheet2.createRow(firstData + j2);
                }
                boolean lastDataRow2 = false;
                System.out.println("第" + j2 + "行，m:" + m2);
                if (j2 + 1 == m2) {
                    lastDataRow2 = true;
                }
                List li2 = (List) list2.get(j2);
                for (int i12 = 0; i12 < li2.size(); i12++) {
                    Cell cc2 = rows2.getCell(firstCellIndex2 + i12);
                    if (cc2 == null) {
                        cc2 = rows2.createCell(firstCellIndex2 + i12);
                        cc2.setCellStyle(styleC2);
                    }
                    if (lastDataRow2) {
                    }
                    if (li2.get(i12) != null && cc2 != null) {
                        CellStyle style3 = cc2.getCellStyle();
                        if (i12 == 0) {
                        }
                        Font font3 = ((XSSFCellStyle) style3).getFont();
                        short oldsize3 = font3.getFontHeightInPoints();
                        if (oldsize3 > PoiUtil.getNewFrontSize(sheet2, rows2, cc2, li2.get(i12).toString(), oldsize3)) {
                            if (!lastDataRow2) {
                                CellStyle styleN5 = wb.createCellStyle();
                                styleN5.cloneStyleFrom(style3);
                                styleN5.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN5 = wb.createFont();
                                fontN5.setBold(font3.getBold());
                                fontN5.setFontName(font3.getFontName());
                                fontN5.setFontHeightInPoints(oldsize3);
                                styleN5.setFont(fontN5);
                                cc2.setCellStyle(styleN5);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN6 = wb.createCellStyle();
                                styleN6.cloneStyleFrom(style3);
                                styleN6.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN6 = wb.createFont();
                                fontN6.setBold(font3.getBold());
                                fontN6.setFontName(font3.getFontName());
                                fontN6.setFontHeightInPoints(oldsize3);
                                styleN6.setFont(fontN6);
                                cc2.setCellStyle(styleN6);
                            }
                        } else if (lastDataRow2) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN7 = wb.createCellStyle();
                            styleN7.cloneStyleFrom(style3);
                            styleN7.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN7 = wb.createFont();
                            fontN7.setBold(font3.getBold());
                            fontN7.setFontName(font3.getFontName());
                            fontN7.setFontHeightInPoints(oldsize3);
                            styleN7.setFont(fontN7);
                            cc2.setCellStyle(styleN7);
                        }
                        cc2.setCellValue(li2.get(i12).toString());
                    } else if (lastDataRow2) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style4 = cc2.getCellStyle();
                            Font font4 = ((XSSFCellStyle) style4).getFont();
                            short oldsize4 = font4.getFontHeightInPoints();
                            CellStyle styleN8 = wb.createCellStyle();
                            styleN8.cloneStyleFrom(style4);
                            styleN8.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN8 = wb.createFont();
                            fontN8.setBold(font4.getBold());
                            fontN8.setFontName(font4.getFontName());
                            fontN8.setFontHeightInPoints(oldsize4);
                            styleN8.setFont(fontN8);
                            cc2.setCellStyle(styleN8);
                        } catch (Exception e2) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields5_2(List<CadreData> data2, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/县级干部名册2.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(2);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row2.getCell(firstCellIndex).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + j);
                if (rows == null) {
                    rows = sheet.createRow(firstData + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields5_3(List<CadreData> data2_1, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/科级干部名册.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2_1.get(0).getList().size();
        sheet.getRow(2);
        Row row2 = sheet.getRow(2);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row2.getCell(firstCellIndex).getCellStyle();
        for (int i = 0; i < data2_1.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2_1.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + j);
                if (rows == null) {
                    rows = sheet.createRow(firstData + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields6(List<CadreData> data2, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/书记干部任免上会表.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(1);
        Row row21 = sheet.getRow((int) firstData);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row21.getCell(0).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(2 + j);
                if (rows == null) {
                    rows = sheet.createRow(2 + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    styleC.setAlignment(HorizontalAlignment.forInt((short) 2));
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    } else {
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        try {
            if (data2.get(0).getList() == null || data2.get(0).getList().size() <= 10) {
                Row rows2 = sheet.getRow(12);
                if (rows2 == null) {
                    rows2 = sheet.createRow(12);
                }
                Cell cc2 = rows2.getCell(firstCellIndex);
                if (cc2 == null) {
                    cc2 = rows2.createCell(firstCellIndex);
                    CellStyle styleLast = cc2.getCellStyle();
                    styleLast.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cc2.setCellStyle(styleLast);
                }
                cc2.setCellValue("    书记专题会议时间：    年  月   日");
                sheet.addMergedRegion(new CellRangeAddress(12, 12, 0, 12));
            } else {
                Row rows3 = sheet.getRow(data2.get(0).getList().size() + 2);
                if (rows3 == null) {
                    rows3 = sheet.createRow(data2.get(0).getList().size() + 2);
                }
                Cell cc3 = rows3.getCell(firstCellIndex);
                if (cc3 == null) {
                    cc3 = rows3.createCell(firstCellIndex);
                    CellStyle styleLast2 = cc3.getCellStyle();
                    styleLast2.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cc3.setCellStyle(styleLast2);
                }
                cc3.setCellValue("    书记专题会议时间：    年  月   日");
                sheet.addMergedRegion(new CellRangeAddress(data2.get(0).getList().size() + 2, data2.get(0).getList().size() + 2, 0, 12));
            }
        } catch (Exception e2) {
            System.out.println(">>>>>>>>最后一行,输出错误");
        }
        return wb;
    }

    private Workbook getWorkbookByFieldsHBT(List<CadreData> data2, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/环保厅花名册.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        int theYear = Calendar.getInstance().get(1);
        int y1 = 0;
        for (int y = firstData; y > 0; y--) {
            sheet.getRow(1).getCell(21 + y1).setCellValue((theYear - y) + "年度考核结果");
            y1++;
        }
        Row row2 = sheet.getRow(1);
        Row row21 = sheet.getRow(1);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row21.getCell(0).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(2 + j);
                if (rows == null) {
                    rows = sheet.createRow(2 + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    styleC.setAlignment(HorizontalAlignment.forInt((short) 2));
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    } else {
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFieldsHuizong(List<CadreData> data2, String[] fieldNames, String excelPath, String lastText) {
        Workbook wb = PoiUtil.createWorkbook(excelPath);
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(4);
        Row row21 = sheet.getRow(4);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row21.getCell(0).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(4 + j);
                if (rows == null) {
                    rows = sheet.createRow(4 + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    styleC.setAlignment(HorizontalAlignment.forInt((short) 2));
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    } else {
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        if (null != lastText) {
            try {
                if (data2.get(0).getList() == null || data2.get(0).getList().size() <= 10) {
                    Row rows2 = sheet.getRow(14);
                    Row rows1 = sheet.getRow(13);
                    if (rows2 == null) {
                        rows2 = sheet.createRow(14);
                    }
                    Cell cc2 = rows2.getCell(firstCellIndex);
                    if (cc2 == null) {
                        cc2 = rows2.createCell(firstCellIndex);
                        sheet.addMergedRegion(new CellRangeAddress(14, 14, 0, (int) len));
                        CellStyle styleLast = rows1.getCell(0).getCellStyle();
                        styleLast.setAlignment(HorizontalAlignment.forInt((short) 1));
                        styleLast.setBorderBottom(BorderStyle.valueOf((short) 1));
                        styleLast.setBorderLeft(BorderStyle.valueOf((short) 1));
                        styleLast.setBorderTop(BorderStyle.valueOf((short) 1));
                        styleLast.setBorderRight(BorderStyle.valueOf((short) 1));
                        cc2.setCellStyle(styleLast);
                    }
                    cc2.setCellValue(lastText);
                } else {
                    Row rows3 = sheet.getRow(data2.get(0).getList().size() + 4);
                    Row rows12 = sheet.getRow(data2.get(0).getList().size() + firstData);
                    if (rows3 == null) {
                        rows3 = sheet.createRow(data2.get(0).getList().size() + 4);
                    }
                    Cell cc3 = rows3.getCell(firstCellIndex);
                    if (cc3 == null) {
                        cc3 = rows3.createCell(firstCellIndex);
                        sheet.addMergedRegion(new CellRangeAddress(data2.get(0).getList().size() + 4, data2.get(0).getList().size() + 4, 0, (int) len));
                        CellStyle styleLast2 = rows12.getCell(0).getCellStyle();
                        styleLast2.setAlignment(HorizontalAlignment.forInt((short) 1));
                        styleLast2.setBorderBottom(BorderStyle.valueOf((short) 1));
                        styleLast2.setBorderLeft(BorderStyle.valueOf((short) 1));
                        styleLast2.setBorderTop(BorderStyle.valueOf((short) 1));
                        styleLast2.setBorderRight(BorderStyle.valueOf((short) 1));
                        cc3.setCellStyle(styleLast2);
                    }
                    cc3.setCellValue(lastText);
                }
            } catch (Exception e2) {
                System.out.println(">>>>>>>>最后一行,输出错误");
            }
        }
        return wb;
    }

    private Workbook getWorkbookByFields1(List<CadreData> data2, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/部务干部任免上会表.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(1);
        Row row21 = sheet.getRow((int) firstData);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row21.getCell(0).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(2 + j);
                if (rows == null) {
                    rows = sheet.createRow(2 + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    styleC.setAlignment(HorizontalAlignment.forInt((short) 2));
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    } else {
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        try {
            if (data2.get(0).getList() == null || data2.get(0).getList().size() <= 10) {
                Row rows2 = sheet.getRow(12);
                if (rows2 == null) {
                    rows2 = sheet.createRow(12);
                }
                Cell cc2 = rows2.getCell(firstCellIndex);
                if (cc2 == null) {
                    cc2 = rows2.createCell(firstCellIndex);
                    CellStyle styleLast = cc2.getCellStyle();
                    styleLast.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cc2.setCellStyle(styleLast);
                }
                cc2.setCellValue("   部务会议时间：    年  月   日");
                sheet.addMergedRegion(new CellRangeAddress(12, 12, 0, 12));
            } else {
                Row rows3 = sheet.getRow(data2.get(0).getList().size() + 2);
                if (rows3 == null) {
                    rows3 = sheet.createRow(data2.get(0).getList().size() + 2);
                }
                Cell cc3 = rows3.getCell(firstCellIndex);
                if (cc3 == null) {
                    cc3 = rows3.createCell(firstCellIndex);
                    CellStyle styleLast2 = cc3.getCellStyle();
                    styleLast2.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cc3.setCellStyle(styleLast2);
                }
                cc3.setCellValue("    部务会议时间：    年  月   日");
                sheet.addMergedRegion(new CellRangeAddress(data2.get(0).getList().size() + 2, data2.get(0).getList().size() + 2, 0, 12));
            }
        } catch (Exception e2) {
            System.out.println(">>>>>>>>最后一行,输出错误");
        }
        return wb;
    }

    private Workbook getWorkbookByFields22(List<CadreData> data2, String[] fieldNames) {
        Workbook wb = PoiUtil.createWorkbook("/xls/xianji/常委干部任免上会表.xlsx");
        Sheet sheet = wb.getSheetAt(0);
        data2.get(0).getList().size();
        Row row2 = sheet.getRow(1);
        Row row21 = sheet.getRow((int) firstData);
        int firstCellIndex = row2.getFirstCellNum();
        CellStyle styleC = row21.getCell(0).getCellStyle();
        for (int i = 0; i < data2.size(); i++) {
            sheet.getRow(1 + (8 * i));
            List list = data2.get(i).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(2 + j);
                if (rows == null) {
                    rows = sheet.createRow(2 + j);
                }
                boolean lastDataRow = false;
                System.out.println("第" + j + "行，m:" + m);
                if (j + 1 == m) {
                    lastDataRow = true;
                }
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    styleC.setAlignment(HorizontalAlignment.forInt((short) 2));
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i1);
                        cc.setCellStyle(styleC);
                    } else {
                        cc.setCellStyle(styleC);
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i1) != null && cc != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i1 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        if (oldsize > PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize)) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(oldsize);
                                styleN.setFont(fontN);
                                cc.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(oldsize);
                                styleN2.setFont(fontN2);
                                cc.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc.setCellStyle(styleN3);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
        }
        try {
            if (data2.get(0).getList() == null || data2.get(0).getList().size() <= 10) {
                Row rows2 = sheet.getRow(12);
                if (rows2 == null) {
                    rows2 = sheet.createRow(12);
                }
                Cell cc2 = rows2.getCell(firstCellIndex);
                if (cc2 == null) {
                    cc2 = rows2.createCell(firstCellIndex);
                    CellStyle styleLast = cc2.getCellStyle();
                    styleLast.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cc2.setCellStyle(styleLast);
                }
                cc2.setCellValue("    常委专题会议时间：   年  月   日");
                sheet.addMergedRegion(new CellRangeAddress(12, 12, 0, 12));
            } else {
                Row rows3 = sheet.getRow(data2.get(0).getList().size() + 2);
                if (rows3 == null) {
                    rows3 = sheet.createRow(data2.get(0).getList().size() + 2);
                }
                Cell cc3 = rows3.getCell(firstCellIndex);
                if (cc3 == null) {
                    cc3 = rows3.createCell(firstCellIndex);
                    CellStyle styleLast2 = cc3.getCellStyle();
                    styleLast2.setAlignment(HorizontalAlignment.forInt((short) 1));
                    cc3.setCellStyle(styleLast2);
                }
                cc3.setCellValue("    常委专题会议时间：   年  月   日");
                sheet.addMergedRegion(new CellRangeAddress(data2.get(0).getList().size() + 2, data2.get(0).getList().size() + 2, 0, 12));
            }
        } catch (Exception e2) {
            System.out.println(">>>>>>>>最后一行,输出错误");
        }
        return wb;
    }

    @PostMapping({"/person/cadreListExcel"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("人员列表：干部列表excel导出")
    @ResponseBody
    public void exportCadreListExcel(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        try {
            PoiUtil.writeExcel(setData(this.personService.selectListForExport(params), "干部列表"), response, "干部列表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreListExcelNew"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("人员列表：干部列表excel自定义列导出")
    @ResponseBody
    public void exportCadreListExcelNew(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        try {
            PoiUtil.writeExcel(setDataCadreList(this.personService.selectListForExport(params), "干部列表", ((String) params.get("fieldStr")).split(","), ((String) params.get("fieldNameStr")).split(",")), response, "干部列表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreListExcelNew2"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("人员列表：干部列表excel固定列导出")
    @ResponseBody
    public void exportCadreListExcelNew2(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        params.put("pageNum", "1");
        params.put("pageSize", "9999999");
        PageInfo page = this.personService.selectList(params);
        List arrayList = new ArrayList();
        if (page.getList() != null) {
            arrayList = page.getList();
        }
        String[] fields = {"a0101", "a0183", "a0185", "a0142", "aa01", "a0108", "a0138", "a0184a", "a0187", "a0188", "a0190", "a0191", "a0177a", "remark"};
        String[] fieldNames = {"姓名", "职务", "任现职时间", "任现职级时间", "出生年月", "籍贯", "工作时间", "入党时间", "全日制学历", "毕业院校及专业", "在职学历", "毕业院校及专业", "主要经历", "备注"};
        List flowidList = new ArrayList();
        Iterator<?> it = arrayList.iterator();
        while (it.hasNext()) {
            flowidList.add(((A01) it.next()).getFlowid());
        }
        List<CadreData> dataList = Lists.newArrayList();
        List<PersonVO> personList = this.reportService.getListByIdList2(flowidList);
        CadreData cadreData = new CadreData();
        cadreData.setList(personList);
        cadreData.setName("全部干部");
        dataList.add(cadreData);
        List<String> objects2 = Lists.newArrayList();
        for (String str : fields) {
            objects2.add(str);
        }
        if (objects2.contains("a0106") && !objects2.contains("aa01")) {
            objects2.add("aa01");
        }
        List<CadreData> data = getDataByFields2(dataList, StringUtils.join(objects2, ","));
        ArrayList<String> objects = new ArrayList<>();
        Lists.newArrayList(new String[]{"性别", "名族", "编制", "身份", "出生", "健康", "全日", "专长", "熟悉", "主要", "管理", "人员", "编制类型", "身份证号", "出生地", "健康状况", "全日制学位", "熟悉领域", "民族", "主要特点及不足", "管理类别(省管、市管、县管、其他)", "人员id", "任现职务层次时间"});
        for (String str2 : fieldNames) {
            objects.add(str2);
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFields3(data, (String[]) objects.toArray(new String[objects.size()])), response, "干部名册");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/cadreExportExcelForIdsNew"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：干部列表excel自定义列导出")
    @ResponseBody
    public void cadreExportExcelForIdsNew(@RequestParam Map<String, String> params, HttpServletResponse response) {
        String[] flowids = params.get("flowids").split(",");
        String[] fields = params.get("fieldStr").split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        List<A01> sortList = new ArrayList<>();
        for (String str : flowids) {
            A01 entity = (A01) this.a01Service.getById(str);
            String a0105 = entity.getA0105();
            boolean b = StringUtils.isNotEmpty(a0105) && "女".equals(a0105);
            String a0130 = entity.getA0130();
            boolean b1 = StringUtils.isNotEmpty(a0130) && !"汉族".equals(a0130);
            StringBuilder sb = new StringBuilder();
            if (b && !b1) {
                sb.append("(女)");
            }
            if (b && b1) {
                sb.append("(女,");
                sb.append(a0130);
                sb.append(")");
            }
            if (!b && b1) {
                sb.append("(");
                sb.append(a0130);
                sb.append(")");
            }
            if (StringUtils.isNotBlank(sb.toString())) {
                entity.setA0101(entity.getA0101() + "\n" + sb.toString());
            }
            sortList.add(entity);
        }
        try {
            PoiUtil.writeExcel(setDataCadreList(sortList, "干部列表", fields, fieldNames), response, "干部列表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    @PostMapping({"/person/excel"})
    @ApiImplicitParam(name = "jsonStr", value = "单位信息字符串", required = true, paramType = "query", defaultValue = "[{\"name\": \"临时单位\",\"id\": \"3\",\"list\": [{\"a0108\": \"山西省忻州市偏关县\",\"a0138\": 1557828214561,\"a0187\": \"北京大学\",\"aa01\": \"1953.08\\n(65岁)\",\"a0101\": \"张璧\\n(女,布依族)\",\"aa03\": \"1972.08\\n(中国国民党革命委员会)\",\"a0188\": \"北京大学哲学\",\"aa02\": \"正省\\n1972.08\",\"a0183\": \"1\",\"a0185\": 1557828214561,\"a0190\": \"清华大学\",\"a0191\": \"北京吉利学院教育学\",\"a0177a\": \"房管局局长,车管所所长\"},{\"a0108\": \"山西省忻州市偏关县\",\"a0138\": 1557828214561,\"a0187\": \"北京大学\",\"aa01\": \"1953.08\\n(65岁)\",\"a0101\": \"张璧\\n(女,布依族)\",\"aa03\": \"1972.08\\n(中国国民党革命委员会)\",\"a0188\": \"北京大学哲学\",\"aa02\": \"正省\\n1972.08\",\"a0183\": \"1\",\"a0185\": 1557828214561,\"a0190\": \"清华大学\",\"a0191\": \"北京吉利学院教育学\",\"a0177a\": \"房管局局长,车管所所长\"}]},{\"name\": \"市委\",\"id\": \"2\",\"list\":[]},{\"name\": \"干部一科\",\"id\": \"3\",\"list\":[]},{\"name\": \"干部一科\",\"id\": \"3\",\"list\":[]},{\"name\": \"干部三科\",\"id\": \"4\",\"list\":[]},{\"name\": \"干部四科\",\"id\": \"5\",\"list\":[]}]")
    @ApiOperation("干部名册：干部名册报表excel导出")
    @ResponseBody
    public void exportUnitExcel(String jsonStr, HttpServletResponse response) {
        try {
            PoiUtil.writeExcel(getWorkbook(getData2(getData(getDataList(checkData(jsonStr))))), response, "单位名册报表");
        } catch (IOException e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    private List<CadreData> checkData(String jsonStr) {
        try {
            List<CadreData> cData = JSON.parseArray(jsonStr, CadreData.class);
            if (!CollectionUtils.isEmpty(cData)) {
                return cData;
            }
            throw new CadreException(ResultEnum.NULL_ERROR);
        } catch (Exception e) {
            e.printStackTrace();
            throw new CadreException(ResultEnum.PARAMETER_ERROR);
        }
    }

    private List<CadreData> getDataList(List<CadreData> cData) {
        List<CadreData> dataList = Lists.newArrayList();
        for (CadreData cDatum : cData) {
            if (CollectionUtils.isEmpty(cDatum.getList())) {
                String id = cDatum.getId();
                String unitName = cDatum.getName();
                List ls = (List) this.reportService.selectPersonListById(id).getData();
                CadreData cadreData = new CadreData();
                cadreData.setList(ls);
                cadreData.setName(unitName);
                dataList.add(cadreData);
            } else {
                CadreData cadreData2 = new CadreData();
                List list1 = cDatum.getList();
                new ArrayList();
                cadreData2.setList(this.reportService.getListByIdList(list1));
                cadreData2.setName(cDatum.getName());
                dataList.add(cadreData2);
            }
        }
        return dataList;
    }

    private Workbook getWorkbook(List<CadreData> data2) {
        String temPath = this.config.getExcelTmp();
        if (this.isShow.booleanValue()) {
            temPath = this.config.getExcelTmp1();
        }
        Workbook wb = PoiUtil.createWorkbook(temPath);
        Sheet sheet = wb.getSheetAt(0);
        if (data2.size() > 1) {
            int n = data2.size() - 1;
            for (int i = 0; i < n; i++) {
                PoiUtil.copyRows(1, rowNum, (i + 1) * 8, sheet);
            }
        }
        int firstCellIndex = sheet.getRow(2).getFirstCellNum();
        int n2 = data2.size();
        for (int i2 = 0; i2 < n2; i2++) {
            sheet.getRow(1 + (8 * i2)).getCell(0).setCellValue(data2.get(i2).getName());
            List list = data2.get(i2).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + (8 * i2) + j);
                List li = (List) list.get(j);
                for (int i1 = 0; i1 < li.size(); i1++) {
                    Cell cc = rows.getCell(firstCellIndex + i1);
                    if (li.get(i1) != null) {
                        CellStyle style = cc.getCellStyle();
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        short newsize = PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i1).toString(), oldsize);
                        if (oldsize > newsize) {
                            CellStyle styleN = wb.createCellStyle();
                            styleN.cloneStyleFrom(style);
                            Font fontN = wb.createFont();
                            fontN.setBold(font.getBold());
                            fontN.setFontName(font.getFontName());
                            fontN.setFontHeightInPoints(newsize);
                            styleN.setFont(fontN);
                            cc.setCellStyle(styleN);
                        }
                        cc.setCellValue(li.get(i1).toString());
                    }
                }
            }
        }
        return wb;
    }

    private List<CadreData> getData2(List<CadreData> data) {
        List<CadreData> data2 = new ArrayList<>();
        for (CadreData datum : data) {
            List list = datum.getList();
            if (list == null) {
                return null;
            }
            int size = list.size();
            int i = size / len;
            if (i != 0) {
                for (int j = 0; j < i; j++) {
                    List ls = list.subList(j * len, (j + 1) * len);
                    CadreData cadreData = new CadreData();
                    cadreData.setList(ls);
                    cadreData.setName(datum.getName());
                    data2.add(cadreData);
                }
                if (i * len < size) {
                    List ls2 = list.subList(i * len, size);
                    CadreData cadreData2 = new CadreData();
                    cadreData2.setList(ls2);
                    cadreData2.setName(datum.getName());
                    data2.add(cadreData2);
                }
            } else {
                data2.add(datum);
            }
        }
        return data2;
    }

    private List<CadreData> getData(List<CadreData> dataList) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                if (vo.getA0101() == null) {
                    newArrayList.add("");
                }
                newArrayList.add(formatNameForExcel(vo.getA0101()));
                newArrayList.add(vo.getA0183());
                newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                newArrayList.add(vo.getAa02());
                newArrayList.add(vo.getAa01());
                newArrayList.add(formatJiGuan(vo.getA0108()));
                newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                newArrayList.add(vo.getA0184a());
                newArrayList.add(vo.getA0187());
                newArrayList.add(vo.getA0188());
                newArrayList.add(vo.getA0190());
                newArrayList.add(vo.getA0191());
                if (this.isShow.booleanValue()) {
                    newArrayList.add(vo.getA0186());
                }
                newArrayList.add(vo.getA0177a());
                newArrayList.add(vo.getRemark());
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    @PostMapping({"/person/pdf"})
    @ApiImplicitParam(name = "jsonStr", value = "单位信息字符串", required = true, paramType = "query", defaultValue = "[{\"name\": \"临时单位\",\"id\": \"3\",\"list\": [{\"a0108\": \"山西省忻州市偏关县\",\"a0138\": 1557828214561,\"a0187\": \"北京大学\",\"aa01\": \"1953.08\\n(65岁)\",\"a0101\": \"张璧\\n(女,布依族)\",\"aa03\": \"1972.08\\n(中国国民党革命委员会)\",\"a0188\": \"北京大学哲学\",\"aa02\": \"正省\\n1972.08\",\"a0183\": \"1\",\"a0185\": 1557828214561,\"a0190\": \"清华大学\",\"a0191\": \"北京吉利学院教育学\",\"a0177a\": \"房管局局长,车管所所长\"},{\"a0108\": \"山西省忻州市偏关县\",\"a0138\": 1557828214561,\"a0187\": \"北京大学\",\"aa01\": \"1953.08\\n(65岁)\",\"a0101\": \"张璧\\n(女,布依族)\",\"aa03\": \"1972.08\\n(中国国民党革命委员会)\",\"a0188\": \"北京大学哲学\",\"aa02\": \"正省\\n1972.08\",\"a0183\": \"1\",\"a0185\": 1557828214561,\"a0190\": \"清华大学\",\"a0191\": \"北京吉利学院教育学\",\"a0177a\": \"房管局局长,车管所所长\"}]},{\"name\": \"市委\",\"id\": \"2\",\"list\":[]},{\"name\": \"干部一科\",\"id\": \"3\",\"list\":[]},{\"name\": \"干部一科\",\"id\": \"3\",\"list\":[]},{\"name\": \"干部三科\",\"id\": \"4\",\"list\":[]},{\"name\": \"干部四科\",\"id\": \"5\",\"list\":[]}]")
    @ApiOperation("干部名册：干部名册报表pdf导出")
    @ResponseBody
    public void toPDF(String jsonStr, String fieldStr, String fieldNameStr, HttpServletResponse response) {
        List<CadreData> cData = checkData(jsonStr);
        new ArrayList();
        String[] fields = fieldStr.split(",");
        String[] fieldNames = fieldNameStr.split(",");
        String unitNames = "";
        for (int i = 0; i < cData.size(); i++) {
            unitNames = unitNames + cData.get(i).getName() + ",";
        }
        try {
            cData.get(0).setName(unitNames.substring(0, unitNames.length() - 1));
        } catch (Exception e) {
        }
        try {
            List<CadreData> arrayList = new ArrayList<>();
            arrayList.add(cData.get(0));
            cData = arrayList;
        } catch (Exception e2) {
        }
        Workbook wb = getWorkbookByFields(getData2(getDataByFields(getDataList(cData), fieldStr)), fields, fieldNames);
        String dateStr = "单位名册报表" + new SimpleDateFormat("yyyy.MM.dd").format(new Date());
        String file1 = this.config.getFile() + RandomUtil.getRandom() + "/";
        File folder = new File(file1);
        if (!folder.exists()) {
            folder.mkdirs();
        }
        String url = file1 + dateStr + ".xlsx";
        System.out.println("xlsx path:" + url);
        String pdfUrl = file1 + dateStr + ".pdf";
        PoiUtil.writeExcel(wb, url);
        try {
            String url2 = URLDecoder.decode(url, "utf-8");
            pdfUrl = URLDecoder.decode(pdfUrl, "utf-8");
            Office2PDF.excel2Pdf(url2, pdfUrl);
        } catch (Exception e3) {
            e3.printStackTrace();
        }
        WordUtils.toDownload(new File(pdfUrl), response);
    }

    @PostMapping({"/person/pdfHaveUnitName"})
    @ApiOperation("目前使用-干部名册：干部名册报表pdf导出")
    @ResponseBody
    public void pdfHaveUnitName(@RequestBody Map<String, String> params, HttpServletResponse response) {
        String flowids = params.get("ids");
        String[] fields = params.get("fieldStr").split(",");
        String[] fieldNames = params.get("fieldNameStr").split(",");
        if (StringUtils.isBlank(flowids)) {
            throw new CadreException(ResultEnum.EXPORT_DATA_IS_NULL);
        }
        List<CadreData> dataList = Lists.newArrayList();
        Map<String, List<PersonVO>> mapList = (Map) ((List<PersonVO>) this.reportService.selectPersonListById(flowids).getData()).stream().collect(Collectors.groupingBy(p -> {
            return p.getB01Id();
        }));
        for (String unitId : mapList.keySet()) {
            List<PersonVO> personVOS = mapList.get(unitId);
            CadreData cadreData = new CadreData();
            cadreData.setId(unitId);
            cadreData.setList(personVOS);
            cadreData.setName(personVOS.get(0).getB0101());
            dataList.add(cadreData);
        }
        Workbook wb = getWorkbookContainUnitName(getData2(getDataByFields(dataList, params.get("fieldStr").toString())), fields, fieldNames);
        String dateStr = "单位名册报表" + new SimpleDateFormat("yyyy.MM.dd").format(new Date());
        String file1 = this.config.getFile() + RandomUtil.getRandom() + "/";
        File folder = new File(file1);
        if (!folder.exists()) {
            folder.mkdirs();
        }
        String url = file1 + dateStr + ".xlsx";
        System.out.println("xlsx path:" + url);
        PoiUtil.writeExcel(wb, url);
        WordUtils.toDownload(new File(url), response);
    }

    @PostMapping({"/person/toPDFCustom"})
    @ApiOperation("自定义花名册：报表pdf导出")
    @ResponseBody
    public void toPDFCustom(String jsonStr, String fieldStr, String fieldNameStr, HttpServletResponse response) {
        String[] fields = fieldStr.split(",");
        String[] fieldNames = fieldNameStr.split(",");
        List<CadreData> cData = new ArrayList<>();
        List<String> ids = Arrays.asList(StringUtils.split(jsonStr, ","));
        CadreData c = new CadreData();
        c.setName("自定义干部名册");
        c.setList(ids);
        cData.add(c);
        Workbook wb = getWorkbookByFields(getData2(getDataByFields(getDataList(cData), fieldStr)), fields, fieldNames);
        String dateStr = "单位名册报表" + new SimpleDateFormat("yyyy.MM.dd").format(new Date());
        String file1 = this.config.getFile() + RandomUtil.getRandom() + "/";
        File folder = new File(file1);
        if (!folder.exists()) {
            folder.mkdirs();
        }
        String url = file1 + dateStr + ".xlsx";
        System.out.println("xlsx path:" + url);
        String pdfUrl = file1 + dateStr + ".pdf";
        PoiUtil.writeExcel(wb, url);
        try {
            String url2 = URLDecoder.decode(url, "utf-8");
            pdfUrl = URLDecoder.decode(pdfUrl, "utf-8");
            Office2PDF.excel2Pdf(url2, pdfUrl);
        } catch (Exception e) {
            e.printStackTrace();
        }
        WordUtils.toDownload(new File(pdfUrl), response);
    }

    private List<CadreData> getDataByFields(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("A0195")) {
                    newArrayList.add(vo.getA0195());
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsXianji(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsXianji_1(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add(vo.getAa03());
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add(vo.getAa04());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsKeji_1(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add(vo.getAa03());
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add(vo.getAa04());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsShuji(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("XBLANK3")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsHBT(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            int nox = 1;
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("NOX")) {
                    newArrayList.add(Integer.valueOf(nox));
                }
                if (fieldStr.contains("CHUSHI")) {
                    if (vo.getSuoshucs() != null) {
                        newArrayList.add(vo.getSuoshucs());
                    } else {
                        newArrayList.add("");
                    }
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(vo.getA0101());
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("A0198")) {
                    newArrayList.add(vo.getA0198());
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(vo.getA0108());
                }
                if (fieldStr.contains("A0130")) {
                    newArrayList.add(vo.getA0130());
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0189")) {
                    newArrayList.add(vo.getA0189());
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (fieldStr.contains("A0202")) {
                    newArrayList.add(DateUtils.format(vo.getA0202(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0203")) {
                    newArrayList.add(vo.getA0203());
                }
                if (fieldStr.contains("A0180")) {
                    newArrayList.add(DateUtils.format(vo.getA0180(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(DateUtils.format(vo.getA0142(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0177B")) {
                    newArrayList.add(vo.getA0177b());
                }
                if (fieldStr.contains("KAOHE3")) {
                    if (vo.getKaohe3() != null) {
                        newArrayList.add(vo.getKaohe3());
                    } else {
                        newArrayList.add("");
                    }
                }
                if (fieldStr.contains("KAOHE2")) {
                    if (vo.getKaohe2() != null) {
                        newArrayList.add(vo.getKaohe2());
                    } else {
                        newArrayList.add("");
                    }
                }
                if (fieldStr.contains("KAOHE1")) {
                    if (vo.getKaohe1() != null) {
                        newArrayList.add(vo.getKaohe1());
                    } else {
                        newArrayList.add("");
                    }
                }
                if (fieldStr.contains("AGE")) {
                    try {
                        newArrayList.add(Integer.valueOf(AgeUtil.getCurrentAge(vo.getA0106())));
                    } catch (Exception e) {
                        newArrayList.add("");
                    }
                }
                if (fieldStr.contains("ISJUN")) {
                    newArrayList.add(vo.getIsjun());
                }
                if (fieldStr.contains("A0107")) {
                    newArrayList.add(vo.getA0107());
                }
                if (fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0152")) {
                    newArrayList.add(vo.getA0152());
                }
                if (fieldStr.contains("A2601")) {
                    newArrayList.add(vo.getA2601());
                }
                if (fieldStr.contains("A79STR")) {
                    newArrayList.add(vo.getA79str());
                }
                datList.add(newArrayList);
                nox++;
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsBuweihui(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("XBLANK3")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsChangweihui(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = ("".equals(o) || "\n".equals(o)) ? add : o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = ("".equals(o2) || "\n".equals(o2)) ? add2 : o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (this.isShow.booleanValue() && fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("XBLANK3")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK4")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFieldsChangweiHuizong(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("XBLANK1")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK2")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK3")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK4")) {
                    newArrayList.add("");
                }
                if (fieldStr.contains("XBLANK5")) {
                    newArrayList.add("");
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private List<CadreData> getDataByFields2(List<CadreData> dataList, String fieldStr) {
        List<CadreData> arrayList = new ArrayList<>();
        for (CadreData data : dataList) {
            CadreData cadreData = new CadreData();
            cadreData.setName(data.getName());
            List<Object> list = data.getList();
            List datList = Lists.newArrayList();
            for (Object obj : list) {
                ArrayList newArrayList = Lists.newArrayList();
                PersonVO vo = (PersonVO) obj;
                fieldStr = fieldStr.toUpperCase();
                if (fieldStr.contains("A0101")) {
                    if (vo.getA0101() == null) {
                        newArrayList.add("");
                    } else {
                        newArrayList.add(formatNameForExcel(vo.getA0101()));
                    }
                }
                if (fieldStr.contains("A0183")) {
                    newArrayList.add(vo.getA0183());
                }
                if (fieldStr.contains("A0185")) {
                    newArrayList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0142")) {
                    newArrayList.add(vo.getAa02());
                }
                if (fieldStr.contains("A0180")) {
                    newArrayList.add(DateUtils.format(vo.getA0180(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("AA01")) {
                    newArrayList.add(vo.getAa01());
                } else if (!fieldStr.contains("AA01") && fieldStr.contains("A0106")) {
                    newArrayList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0108")) {
                    newArrayList.add(formatJiGuan(vo.getA0108()));
                }
                if (fieldStr.contains("A0138")) {
                    newArrayList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if (fieldStr.contains("A0184A")) {
                    newArrayList.add(vo.getA0184a());
                }
                if (fieldStr.contains("A0187")) {
                    String o = vo.getA0187() == null ? "" : vo.getA0187().replace("null", "");
                    String add = vo.getA0189() == null ? "" : vo.getA0189().replace("null", "");
                    if (add != "" && !o.contains(add)) {
                        o = o + "\r" + add;
                    }
                    newArrayList.add(o);
                }
                if (fieldStr.contains("A0188")) {
                    newArrayList.add(vo.getA0188());
                }
                if (fieldStr.contains("A0190")) {
                    String o2 = vo.getA0190() == null ? "" : vo.getA0190().replace("null", "");
                    String add2 = vo.getA0192() == null ? "" : vo.getA0192().replace("null", "");
                    if (add2 != "" && !o2.contains(add2)) {
                        o2 = o2 + "\r" + add2;
                    }
                    newArrayList.add(o2);
                }
                if (fieldStr.contains("A0191")) {
                    newArrayList.add(vo.getA0191());
                }
                if (fieldStr.contains("A0186")) {
                    newArrayList.add(vo.getA0186());
                }
                if (fieldStr.contains("A0105")) {
                    newArrayList.add(vo.getA0105());
                }
                if (fieldStr.contains("A0130")) {
                    newArrayList.add(vo.getA0130());
                }
                if (fieldStr.contains("A0182")) {
                    newArrayList.add(vo.getA0182());
                }
                if (fieldStr.contains("A0107")) {
                    newArrayList.add(vo.getA0107());
                }
                if (fieldStr.contains("A0110")) {
                    newArrayList.add(vo.getA0110());
                }
                if (fieldStr.contains("A0133")) {
                    newArrayList.add(vo.getA0133());
                }
                if (fieldStr.contains("A0189")) {
                    newArrayList.add(vo.getA0189());
                }
                if (fieldStr.contains("A0192")) {
                    newArrayList.add(vo.getA0192());
                }
                if (fieldStr.contains("A0152")) {
                    newArrayList.add(vo.getA0152());
                }
                if (fieldStr.contains("A0176")) {
                    newArrayList.add(vo.getA0176());
                }
                if (fieldStr.contains("A0177A")) {
                    newArrayList.add(vo.getA0177a());
                }
                if (fieldStr.contains("A0175")) {
                    newArrayList.add(vo.getA0175());
                }
                if (fieldStr.contains("A0173")) {
                    newArrayList.add(vo.getA0173());
                }
                if (fieldStr.contains("REMARK")) {
                    newArrayList.add(vo.getRemark());
                }
                if (fieldStr.contains("FLOWID")) {
                    newArrayList.add(vo.getFlowid());
                }
                datList.add(newArrayList);
            }
            cadreData.setList(datList);
            arrayList.add(cadreData);
        }
        return arrayList;
    }

    private Workbook getWorkbookByFields(List<CadreData> data2, String[] fields, String[] fieldNames) {
        String temPath = this.config.getExcelTmp();
        if (temPath.contains("add")) {
            this.MAX_COLUMN_LEN = 15;
        }
        System.out.println("temPath:" + temPath);
        if (this.isShow.booleanValue()) {
            temPath = this.config.getExcelTmp1();
        }
        Workbook wb = PoiUtil.createWorkbook(temPath);
        Sheet sheet = wb.getSheetAt(0);
        if (data2.size() > 1) {
            int n = data2.size() - 1;
            for (int i = 0; i < n; i++) {
                PoiUtil.copyRows(1, rowNum, (i + 1) * 8, sheet);
            }
        }
        int firstCellIndex = sheet.getRow(2).getFirstCellNum();
        int n2 = data2.size();
        for (int i2 = 0; i2 < n2; i2++) {
            Row row = sheet.getRow(1 + (8 * i2));
            Double.valueOf(Math.floor(110.0d / ((double) (fieldNames.length == 0 ? 1 : fieldNames.length)))).intValue();
            if (i2 == 0) {
                row.getCell(0).setCellValue("");
            } else {
                row.getCell(0).setCellValue("");
            }
            for (int i1 = 0; i1 < fieldNames.length; i1++) {
                Cell cellT = sheet.getRow(1 + (8 * i2) + 1).getCell(i1);
                if (cellT != null) {
                    cellT.setCellValue(StringUtils.replace(fieldNames[i1], "\"", ""));
                }
            }
            for (int i22 = fieldNames.length; i22 < this.MAX_COLUMN_LEN; i22++) {
                Row rowT = sheet.getRow(1 + (8 * i2) + 1);
                Cell cellT2 = rowT.getCell(i22);
                cellT2.setCellValue("");
                rowT.removeCell(cellT2);
            }
            List list = data2.get(i2).getList();
            wb.createCellStyle();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + (8 * i2) + j);
                List li = (List) list.get(j);
                for (int i12 = 0; i12 < li.size(); i12++) {
                    if (rows == null) {
                        rows = sheet.createRow(firstData + (8 * i2) + j);
                    }
                    Cell cc = rows.getCell(firstCellIndex + i12);
                    if (cc == null) {
                        cc = rows.createCell(firstCellIndex + i12);
                    }
                    if (li.get(i12) != null) {
                        CellStyle style = cc.getCellStyle();
                        if (i12 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        short newsize = PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i12).toString(), oldsize);
                        if (oldsize > newsize) {
                            CellStyle styleN = wb.createCellStyle();
                            styleN.cloneStyleFrom(style);
                            Font fontN = wb.createFont();
                            fontN.setBold(font.getBold());
                            fontN.setFontName(font.getFontName());
                            fontN.setFontHeightInPoints(newsize);
                            styleN.setFont(fontN);
                            cc.setCellStyle(styleN);
                        }
                        cc.setCellValue(li.get(i12).toString());
                    }
                }
                try {
                    for (int i23 = fieldNames.length; i23 < this.MAX_COLUMN_LEN; i23++) {
                        rows.removeCell(rows.getCell(i23));
                    }
                } catch (Exception e) {
                }
            }
            for (int j1 = 0; j1 < 7; j1++) {
                try {
                    Row rowT2 = sheet.getRow(firstData + (8 * i2) + j1);
                    for (int i24 = fieldNames.length; i24 < this.MAX_COLUMN_LEN; i24++) {
                        Cell cellT3 = rowT2.getCell(i24);
                        cellT3.setCellValue("");
                        rowT2.removeCell(cellT3);
                    }
                } catch (Exception e2) {
                }
            }
        }
        return wb;
    }

    private Workbook getWorkbookContainUnitName(List<CadreData> data2, String[] fields, String[] fieldNames) {
        String temPath = this.config.getExcelTmp();
        if (temPath.contains("add")) {
            this.MAX_COLUMN_LEN = 15;
        }
        System.out.println("temPath:" + temPath);
        if (this.isShow.booleanValue()) {
            temPath = this.config.getExcelTmp1();
        }
        Workbook wb = PoiUtil.createWorkbook(temPath);
        Sheet sheet = wb.getSheetAt(0);
        if (data2.size() > 1) {
            int n = data2.size() - 1;
            for (int i = 0; i < n; i++) {
                PoiUtil.copyRows(1, rowNum, (i + 1) * 8, sheet);
            }
        }
        int firstCellIndex = sheet.getRow(2).getFirstCellNum();
        int n2 = data2.size();
        for (int i2 = 0; i2 < n2; i2++) {
            Row row = sheet.getRow(1 + (8 * i2));
            int width = Double.valueOf(Math.floor(110.0d / ((double) (fieldNames.length == 0 ? 1 : fieldNames.length)))).intValue();
            Cell cell = row.getCell(0);
            if (StringUtils.isNotBlank(data2.get(i2).getName())) {
                cell.setCellValue(data2.get(i2).getName());
            } else {
                cell.setCellValue("");
            }
            for (int i1 = 0; i1 < fieldNames.length; i1++) {
                Cell cellT = sheet.getRow(1 + (8 * i2) + 1).getCell(i1);
                if (cellT != null) {
                    cellT.setCellValue(fieldNames[i1].replace("\"", ""));
                    sheet.setColumnWidth(i1, width * 256);
                }
            }
            for (int i22 = fieldNames.length; i22 < this.MAX_COLUMN_LEN; i22++) {
                Row rowT = sheet.getRow(1 + (8 * i2) + 1);
                Cell cellT2 = rowT.getCell(i22);
                cellT2.setCellValue("");
                rowT.removeCell(cellT2);
            }
            List list = data2.get(i2).getList();
            int m = list.size();
            for (int j = 0; j < m; j++) {
                Row rows = sheet.getRow(firstData + (8 * i2) + j);
                List li = (List) list.get(j);
                for (int i12 = 0; i12 < li.size(); i12++) {
                    Cell cc = rows.getCell(firstCellIndex + i12);
                    if (li.get(i12) != null) {
                        CellStyle style = cc.getCellStyle();
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        short newsize = PoiUtil.getNewFrontSize(sheet, rows, cc, li.get(i12).toString(), oldsize);
                        if (oldsize > newsize) {
                            CellStyle styleN = wb.createCellStyle();
                            styleN.cloneStyleFrom(style);
                            Font fontN = wb.createFont();
                            fontN.setBold(font.getBold());
                            fontN.setFontName(font.getFontName());
                            fontN.setFontHeightInPoints(newsize);
                            styleN.setFont(fontN);
                            cc.setCellStyle(styleN);
                        }
                        cc.setCellValue(li.get(i12).toString());
                    }
                }
                try {
                    for (int i23 = fieldNames.length; i23 < this.MAX_COLUMN_LEN; i23++) {
                        rows.removeCell(rows.getCell(i23));
                    }
                } catch (Exception e) {
                }
            }
            for (int j1 = 0; j1 < 7; j1++) {
                try {
                    Row rowT2 = sheet.getRow(firstData + (8 * i2) + j1);
                    for (int i24 = fieldNames.length; i24 < this.MAX_COLUMN_LEN; i24++) {
                        Cell cellT3 = rowT2.getCell(i24);
                        cellT3.setCellValue("");
                        rowT2.removeCell(cellT3);
                    }
                } catch (Exception e2) {
                }
            }
        }
        return wb;
    }

    private Workbook setData(List<A01> data2, String title) {
        List<List<String>> li = formatData(data2);
        Workbook wb = PoiUtil.createWorkbook(this.config.getExcelRenList());
        Sheet sheet = wb.getSheetAt(0);
        sheet.getRow(0).getCell(0).setCellValue(title);
        if (data2.size() > 1) {
            int n = data2.size() - 1;
            for (int i = 0; i < n; i++) {
                PoiUtil.copyRowsForCadrList(firstData, firstData, i + firstData, sheet);
            }
        }
        int n2 = li.size();
        for (int i2 = 0; i2 < n2; i2++) {
            Row row = sheet.getRow(i2 + 2);
            for (int j = 0; j < li.get(i2).size(); j++) {
                Cell cc = row.getCell(j);
                CellStyle style = cc.getCellStyle();
                Font font = ((XSSFCellStyle) style).getFont();
                short oldsize = font.getFontHeightInPoints();
                short newsize = PoiUtil.getNewFrontSize(sheet, row, cc, li.get(i2).get(j), oldsize);
                if (oldsize > newsize) {
                    CellStyle styleN = wb.createCellStyle();
                    styleN.cloneStyleFrom(style);
                    Font fontN = wb.createFont();
                    fontN.setBold(font.getBold());
                    fontN.setFontName(font.getFontName());
                    fontN.setFontHeightInPoints(newsize);
                    styleN.setFont(fontN);
                    cc.setCellStyle(styleN);
                }
                cc.setCellValue(li.get(i2).get(j));
            }
        }
        return wb;
    }

    private List<List<String>> formatData(List<A01> dataList) {
        List<List<String>> arrayList = new ArrayList<>();
        for (A01 vo : dataList) {
            List<String> datList = Lists.newArrayList();
            datList.add(formatName(vo));
            datList.add(vo.getA0183());
            datList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
            datList.add(formatZhiJi(vo));
            datList.add(formatBrithday(vo.getA0106()));
            datList.add(formatJiGuan(vo.getA0108()));
            datList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
            datList.add(formatFourChar(vo.getA0184a()));
            datList.add(vo.getA0187());
            datList.add(vo.getA0188());
            datList.add(vo.getA0190());
            datList.add(vo.getA0191());
            datList.add(vo.getA0177a());
            datList.add("");
            arrayList.add(datList);
        }
        return arrayList;
    }

    private List<List<String>> formatDataSelectCadre(List<PersonVO> dataList, String[] fields) {
        List<List<String>> arrayList = new ArrayList<>();
        for (PersonVO vo : dataList) {
            List<String> datList = Lists.newArrayList();
            for (String field : fields) {
                if ("a0101".equals(field)) {
                    datList.add(vo.getA0101());
                }
                if ("a0183".equals(field)) {
                    datList.add(vo.getA0183());
                }
                if ("a0185".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("a0180".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0180(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("aa01".equals(field)) {
                    datList.add(formatBrithday(vo.getA0106()));
                }
                if ("a0108".equals(field)) {
                    datList.add(formatJiGuan(vo.getA0108()));
                }
                if ("a0138".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("a0184a".equals(field)) {
                    datList.add(formatFourChar(vo.getA0184a()));
                }
                if ("a0187".equals(field)) {
                    datList.add(vo.getA0187());
                }
                if ("a0188".equals(field)) {
                    datList.add(vo.getA0188());
                }
                if ("a0190".equals(field)) {
                    datList.add(vo.getA0190());
                }
                if ("a0191".equals(field)) {
                    datList.add(vo.getA0191());
                }
                if ("a0177a".equals(field)) {
                    datList.add(vo.getA0177a());
                }
                if ("remark".equals(field)) {
                    datList.add("");
                }
            }
            arrayList.add(datList);
        }
        return arrayList;
    }

    private List<List<String>> formatDataCadreList(List<A01> dataList, String[] fields) {
        List<List<String>> arrayList = new ArrayList<>();
        for (A01 vo : dataList) {
            List<String> datList = Lists.newArrayList();
            for (String field : fields) {
                if ("a0101".equals(field)) {
                    datList.add(vo.getA0101());
                }
                if ("a0183".equals(field)) {
                    datList.add(vo.getA0183());
                }
                if ("a0185".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0185(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("a0180".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0180(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("a0106".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0106(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("a0108".equals(field)) {
                    datList.add(vo.getA0108());
                }
                if ("a0138".equals(field)) {
                    datList.add(DateUtils.format(vo.getA0138(), DateUtil.MONTG_DATE_FORMAT));
                }
                if ("a0184a".equals(field)) {
                    datList.add(vo.getA0184a());
                }
                if ("a0187".equals(field)) {
                    datList.add(vo.getA0187());
                }
                if ("a0188".equals(field)) {
                    datList.add(vo.getA0188());
                }
                if ("a0190".equals(field)) {
                    datList.add(vo.getA0190());
                }
                if ("a0191".equals(field)) {
                    datList.add(vo.getA0191());
                }
                if ("a0186".equals(field)) {
                    datList.add(vo.getA0186());
                }
                if ("a0105".equals(field)) {
                    datList.add(vo.getA0105());
                }
                if ("a0130".equals(field)) {
                    datList.add(vo.getA0130());
                }
                if ("a0182".equals(field)) {
                    datList.add(vo.getA0182());
                }
                if ("a0107".equals(field)) {
                    datList.add(vo.getA0107());
                }
                if ("a0110".equals(field)) {
                    datList.add(vo.getA0110());
                }
                if ("a0133".equals(field)) {
                    datList.add(vo.getA0133());
                }
                if ("a0189".equals(field)) {
                    datList.add(vo.getA0189());
                }
                if ("a0152".equals(field)) {
                    datList.add(vo.getA0152());
                }
                if ("a0176".equals(field)) {
                    datList.add(vo.getA0176());
                }
                if ("a0177a".equals(field)) {
                    datList.add(vo.getA0177a());
                }
                if ("a0175".equals(field)) {
                    datList.add(vo.getA0175());
                }
                if ("a0173".equals(field)) {
                    datList.add(vo.getA0173());
                }
                if ("flowid".equals(field)) {
                    datList.add(vo.getFlowid());
                }
            }
            arrayList.add(datList);
        }
        return arrayList;
    }

    private Workbook setDataCadre(List<PersonVO> data2, String title, String[] fields, String[] fieldNames) {
        List<List<String>> li = formatDataSelectCadre(data2, fields);
        Workbook wb = PoiUtil.createWorkbook(this.config.getExcelRenList());
        CellStyle styleHeader = wb.createCellStyle();
        styleHeader.setVerticalAlignment(VerticalAlignment.forInt((short) 1));
        styleHeader.setAlignment(HorizontalAlignment.forInt((short) 2));
        Font headerFont = wb.createFont();
        headerFont.setFontHeight((short) 700);
        headerFont.setFontName("Times New Roman");
        headerFont.setFontHeightInPoints((short) 12);
        styleHeader.setFont(headerFont);
        for (int i = wb.getNumberOfSheets() - 1; i > -1; i--) {
            wb.removeSheetAt(i);
        }
        Sheet sheet = wb.createSheet("干部名册");
        Row row0 = sheet.createRow(0);
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            Cell cell = row0.createCell(i2);
            cell.setCellStyle(styleHeader);
            cell.setCellValue(fieldNames[i2]);
        }
        int n = li.size();
        for (int i3 = 0; i3 < n; i3++) {
            Row row = sheet.createRow(i3 + 1);
            for (int j = 0; j < li.get(i3).size(); j++) {
                row.createCell(j).setCellValue(li.get(i3).get(j));
            }
        }
        return wb;
    }

    private Workbook setDataCadreList(List<A01> data2, String title, String[] fields, String[] fieldNames) {
        List<List<String>> li = formatDataCadreList(data2, fields);
        Workbook wb = PoiUtil.createWorkbook(this.config.getExcelRenList());
        CellStyle styleHeader = wb.createCellStyle();
        styleHeader.setVerticalAlignment(VerticalAlignment.forInt((short) 1));
        styleHeader.setAlignment(HorizontalAlignment.forInt((short) 2));
        Font headerFont = wb.createFont();
        headerFont.setFontHeight((short) 700);
        headerFont.setFontName("Times New Roman");
        headerFont.setFontHeightInPoints((short) 12);
        styleHeader.setFont(headerFont);
        for (int i = wb.getNumberOfSheets() - 1; i > -1; i--) {
            wb.removeSheetAt(i);
        }
        Sheet sheet = wb.createSheet("干部列表");
        Row row0 = sheet.createRow(0);
        for (int i2 = 0; i2 < fieldNames.length; i2++) {
            Cell cell = row0.createCell(i2);
            cell.setCellStyle(styleHeader);
            cell.setCellValue(fieldNames[i2]);
        }
        int n = li.size();
        for (int i3 = 0; i3 < n; i3++) {
            Row row = sheet.createRow(i3 + 1);
            for (int j = 0; j < li.get(i3).size(); j++) {
                row.createCell(j).setCellValue(li.get(i3).get(j));
            }
        }
        return wb;
    }

    private String formatName(A01 a01) {
        StringBuilder sb = new StringBuilder();
        String name = a01.getA0101();
        if (name.length() == 2) {
            name = name.replaceAll("(\\S)", "$0 ");
        }
        String sex = a01.getA0105() == null ? "男" : a01.getA0105();
        String nation = a01.getA0130() == null ? "汉族" : a01.getA0130();
        if (sex.equals("男") && !nation.equals("汉族")) {
            sb.append(name).append("(").append(nation).append(")");
            return sb.toString();
        } else if (!sex.equals("男") && nation.equals("汉族")) {
            sb.append(name).append("(").append(sex).append(")");
            return sb.toString();
        } else if (sex.equals("男") || nation.equals("汉族")) {
            sb.append(name);
            return sb.toString();
        } else {
            sb.append(name).append("(").append(sex).append("、").append(nation).append(")");
            return sb.toString();
        }
    }

    private String formatNameCadre(PersonVO a01) {
        StringBuilder sb = new StringBuilder();
        String name = a01.getA0101();
        if (name.length() == 2) {
            name = name.replaceAll("(\\S)", "$0 ");
        }
        String sex = a01.getA0105() == null ? "男" : a01.getA0105();
        String nation = a01.getA0130() == null ? "汉族" : a01.getA0130();
        if (sex.equals("男") && !nation.equals("汉族")) {
            sb.append(name).append("(").append(nation).append(")");
            return sb.toString();
        } else if (!sex.equals("男") && nation.equals("汉族")) {
            sb.append(name).append("(").append(sex).append(")");
            return sb.toString();
        } else if (sex.equals("男") || nation.equals("汉族")) {
            sb.append(name);
            return sb.toString();
        } else {
            sb.append(name).append("(").append(sex).append("、").append(nation).append(")");
            return sb.toString();
        }
    }

    private String formatFourChar(String jiguan) {
        if (jiguan == null || jiguan.equals("")) {
            return "";
        }
        String returnvalue = jiguan;
        if (jiguan.length() == 4) {
            returnvalue = jiguan.substring(0, 2) + "\n" + jiguan.substring(2, 4);
        }
        return returnvalue;
    }

    private String formatJiGuan(String jiguan) {
        if (jiguan == null || jiguan.equals("")) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        int length = jiguan.length();
        for (int i = 0; i < jiguan.length(); i += 2) {
            if (i == 0) {
                sb.append(jiguan.substring(i, i + 2));
            } else {
                sb.append("\n").append(jiguan.substring(i, i + 2 > length ? length : i + 2));
            }
        }
        return sb.toString();
    }

    private String formatBrithday(Date brithday) {
        StringBuilder sb = new StringBuilder();
        if (brithday != null) {
            sb.append(DateUtils.format(brithday, DateUtil.MONTG_DATE_FORMAT));
            sb.append("\n(");
            sb.append(AgeUtil.getCurrentAge(brithday));
            sb.append(")");
        }
        return sb.toString();
    }

    private String formatZhiJi(A01 a01) {
        Map<String, String> map = new HashMap<>();
        map.put("省部级正职", "正省");
        map.put("省部级副职", "副省");
        map.put("厅局级正职", "正厅");
        map.put("厅局级副职", "副厅");
        map.put("县处级正职", "正处");
        map.put("县处级副职", "副处");
        map.put("比照正厅级", "正厅");
        map.put("比照副厅级", "副厅");
        map.put("比照正处级", "正处");
        map.put("一级巡视员", "一巡");
        map.put("二级巡视员", "二巡");
        map.put("一级调研员", "一调");
        map.put("二级调研员", "二调");
        map.put("三级调研员", "三调");
        map.put("四级调研员", "四调");
        map.put("乡科级正职", "正科");
        map.put("乡科级副职", "副科");
        StringBuilder sb = new StringBuilder();
        if (a01.getA0180() != null) {
            sb.append(DateUtils.format(a01.getA0180(), DateUtil.MONTG_DATE_FORMAT)).append("\n");
        }
        if (a01.getA0179() != null && !a01.getA0179().equals("")) {
            sb.append(map.get(a01.getA0179()) == null ? "" : map.get(a01.getA0179())).append("\n");
        }
        if (a01.getA0142() != null) {
            sb.append(DateUtils.format(a01.getA0142(), DateUtil.MONTG_DATE_FORMAT)).append("\n");
        }
        if (a01.getA0198() != null && !a01.getA0198().equals("")) {
            sb.append(map.get(a01.getA0198()) == null ? "" : map.get(a01.getA0198())).append("\n");
        }
        if (sb.length() > 0) {
            sb.deleteCharAt(sb.length() - 1).toString();
        }
        return sb.toString();
    }

    private String formatZhiJiCadre(PersonVO a01) {
        Map<String, String> map = new HashMap<>();
        map.put("省部级正职", "正省");
        map.put("省部级副职", "副省");
        map.put("厅局级正职", "正厅");
        map.put("厅局级副职", "副厅");
        map.put("县处级正职", "正处");
        map.put("县处级副职", "副处");
        map.put("比照正厅级", "正厅");
        map.put("比照副厅级", "副厅");
        map.put("比照正处级", "正处");
        map.put("一级巡视员", "一巡");
        map.put("二级巡视员", "二巡");
        map.put("一级调研员", "一调");
        map.put("二级调研员", "二调");
        map.put("三级调研员", "三调");
        map.put("四级调研员", "四调");
        map.put("乡科级正职", "正科");
        map.put("乡科级副职", "副科");
        StringBuilder sb = new StringBuilder();
        if (a01.getA0180() != null) {
            sb.append(DateUtils.format(a01.getA0180(), DateUtil.MONTG_DATE_FORMAT)).append("\n");
        }
        if (a01.getA0179() != null && !a01.getA0179().equals("")) {
            sb.append(map.get(a01.getA0179()) == null ? "" : map.get(a01.getA0179())).append("\n");
        }
        if (a01.getA0142() != null) {
            sb.append(DateUtils.format(a01.getA0142(), DateUtil.MONTG_DATE_FORMAT)).append("\n");
        }
        if (a01.getA0198() != null && !a01.getA0198().equals("")) {
            sb.append(map.get(a01.getA0198()) == null ? "" : map.get(a01.getA0198())).append("\n");
        }
        if (sb.length() > 0) {
            sb.deleteCharAt(sb.length() - 1).toString();
        }
        return sb.toString();
    }

    private String formatNameForExcel(String name) {
        if (name.length() == 2) {
            name = name.replaceAll("(\\S)", "$0 ");
        }
        if (name.indexOf("\n") != -1) {
            String nametemp = name.substring(0, name.indexOf("\n"));
            if (nametemp.length() == 2) {
                name = nametemp.replaceAll("(\\S)", "$0 ") + name.substring(name.indexOf("\n"));
            }
        }
        return name;
    }

    @PostMapping({"/person/buildByModelInfo"})
    @ApiImplicitParam(name = "params", value = "导出条件", required = true, paramType = "query")
    @ApiOperation("列表选择框点击导出：动态干部名册表excel导出")
    @ResponseBody
    public void buildByModelInfo(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        Object[] flowids = String.valueOf(params.get("ids")).split(",");
        String modelId = String.valueOf(params.get("id"));
        Map<String, Object> mapModel = new HashMap<>();
        mapModel.put("id", modelId);
        List<PX_JGXX> list = this.PX_JGXXService.getModelInfos(mapModel);
        PX_JGXX model = new PX_JGXX();
        try {
            model = list.get(0);
        } catch (Exception e) {
        }
        String modelName = model.getJgname();
        Integer.parseInt(model.getRemark());
        List<SysConfigEntity> configList = this.sysConfigService.queryModelInfoConfigs(modelId);
        String[] fields = new String[configList.size()];
        List<String> tables = new ArrayList<>();
        for (int m = 0; m < configList.size(); m++) {
            if (!"A01".equals(configList.get(m).getParamKey()) && !tables.contains(configList.get(m).getParamKey()) && !"".equals(configList.get(m).getParamKey())) {
                tables.add(configList.get(m).getParamKey());
            }
        }
        for (int m2 = 0; m2 < configList.size(); m2++) {
            fields[m2] = configList.get(m2).getParamKey() + "." + configList.get(m2).getParamValue();
            if ("null.null".equals(fields[m2])) {
                fields[m2] = " '' as value" + m2;
            } else {
                fields[m2] = configList.get(m2).getParamKey() + "." + configList.get(m2).getParamValue() + " as value" + m2;
            }
        }
        List flowidList = new ArrayList();
        for (Object id : flowids) {
            flowidList.add(String.valueOf(id));
        }
        List<List<Object>> subFlowidList = averageAssign(flowidList, (flowidList.size() / 50) + 1);
        List<Map<String, Object>> personList = new ArrayList<>();
        for (int i = 0; i < subFlowidList.size(); i++) {
            personList.addAll(this.reportService.getListByIdListCustom(subFlowidList.get(i), fields, tables));
        }
        for (int j = 0; j < personList.size(); j++) {
            try {
                personList.get(j).remove("FLOWID");
            } catch (Exception e2) {
            }
        }
        try {
            PoiUtil.writeExcel(getWorkbookByFieldsCustom(personList, model), response, modelName);
        } catch (IOException e3) {
            e3.printStackTrace();
            throw new CadreException(ResultEnum.EXCEL_ERROR);
        }
    }

    public static <T> List<List<T>> averageAssign(List<T> source, int n) {
        List<T> value;
        List<List<T>> result = new ArrayList<>();
        int remaider = source.size() % n;
        int number = source.size() / n;
        int offset = 0;
        for (int i = 0; i < n; i++) {
            if (remaider > 0) {
                value = source.subList((i * number) + offset, ((i + 1) * number) + offset + 1);
                remaider--;
                offset++;
            } else {
                value = source.subList((i * number) + offset, ((i + 1) * number) + offset);
            }
            result.add(value);
        }
        return result;
    }

    private Workbook getWorkbookByFieldsCustom(List<Map<String, Object>> data2, PX_JGXX pX_JGXX) {
        try {
            InputStream input = new FileInputStream(new File(new File(this.ModelFilePath).getAbsolutePath(), File.separator + pX_JGXX.getJgcode() + ".xlsx"));
            if (input == null) {
                throw new RuntimeException("templatePath excel file load error :" + this.ModelFilePath + " , check templatePath file is exists !");
            }
            Workbook wb = new XSSFWorkbook(input);
            Sheet sheet = wb.getSheetAt(0);
            data2.size();
            int startNum = Integer.parseInt(pX_JGXX.getRemark());
            int firstCellIndex = sheet.getRow(startNum).getFirstCellNum();
            List<CellStyle> styleCs = new ArrayList<>();
            int n = data2.size();
            for (int i = 0; i < n; i++) {
                Row rows = sheet.getRow((startNum + i) - 1);
                if (rows == null) {
                    rows = sheet.createRow((startNum + i) - 1);
                }
                Cell cell = rows.getCell(0);
                if (cell == null) {
                    cell = rows.createCell(0);
                }
                int mergerNum = getMergeColumNum(cell, sheet);
                if (mergerNum > 1) {
                    System.out.println("mergerNum:" + mergerNum + "合并列数大于1需处理");
                    removeMergedRegion(sheet, (startNum + i) - 1, mergerNum);
                }
                cell.setCellValue("");
                List<String> li = new ArrayList<>();
                for (Map.Entry<String, Object> map : data2.get(i).entrySet()) {
                    li.add(String.valueOf(map.getValue()));
                }
                CellStyle styleC = wb.createCellStyle();
                if (i == 0) {
                    for (int i1 = 0; i1 < li.size(); i1++) {
                        Cell cc = rows.getCell(i1);
                        if (cc == null) {
                            styleCs.add(styleC);
                        } else {
                            styleCs.add(cc.getCellStyle());
                        }
                    }
                }
                boolean lastDataRow = false;
                if (i == data2.size() - 1) {
                    lastDataRow = true;
                }
                for (int i12 = 0; i12 < li.size(); i12++) {
                    Cell cc2 = rows.getCell(firstCellIndex + i12);
                    if (cc2 == null) {
                        cc2 = rows.createCell(firstCellIndex + i12);
                        cc2.setCellStyle(styleCs.get(firstCellIndex + i12));
                    } else {
                        cc2.setCellStyle(styleCs.get(firstCellIndex + i12));
                    }
                    if (lastDataRow) {
                    }
                    if (li.get(i12) != null && cc2 != null) {
                        CellStyle style = cc2.getCellStyle();
                        if (i12 == 0) {
                        }
                        Font font = ((XSSFCellStyle) style).getFont();
                        short oldsize = font.getFontHeightInPoints();
                        short newsize = PoiUtil.getNewFrontSize(sheet, rows, cc2, li.get(i12).toString(), oldsize);
                        if (oldsize > newsize) {
                            if (!lastDataRow) {
                                CellStyle styleN = wb.createCellStyle();
                                styleN.cloneStyleFrom(style);
                                styleN.setBorderBottom(BorderStyle.valueOf((short) 0));
                                Font fontN = wb.createFont();
                                fontN.setBold(font.getBold());
                                fontN.setFontName(font.getFontName());
                                fontN.setFontHeightInPoints(newsize);
                                styleN.setFont(fontN);
                                cc2.setCellStyle(styleN);
                            } else {
                                System.out.println(">>>>>>>>最后一行");
                                CellStyle styleN2 = wb.createCellStyle();
                                styleN2.cloneStyleFrom(style);
                                styleN2.setBorderBottom(BorderStyle.valueOf((short) 1));
                                Font fontN2 = wb.createFont();
                                fontN2.setBold(font.getBold());
                                fontN2.setFontName(font.getFontName());
                                fontN2.setFontHeightInPoints(newsize);
                                styleN2.setFont(fontN2);
                                cc2.setCellStyle(styleN2);
                            }
                        } else if (lastDataRow) {
                            System.out.println(">>>>>>>>最后一行,普通");
                            CellStyle styleN3 = wb.createCellStyle();
                            styleN3.cloneStyleFrom(style);
                            styleN3.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN3 = wb.createFont();
                            fontN3.setBold(font.getBold());
                            fontN3.setFontName(font.getFontName());
                            fontN3.setFontHeightInPoints(oldsize);
                            styleN3.setFont(fontN3);
                            cc2.setCellStyle(styleN3);
                        }
                        String valueTemp = String.valueOf(data2.get(i).get("VALUE" + i12));
                        if ("null".equals(valueTemp)) {
                            cc2.setCellValue("");
                        } else if (valueTemp.contains(":00.0")) {
                            try {
                                cc2.setCellValue(valueTemp.substring(0, 7).replace("-", "."));
                            } catch (Exception ex) {
                                ex.printStackTrace();
                                cc2.setCellValue("");
                            }
                        } else {
                            cc2.setCellValue(valueTemp);
                        }
                    } else if (lastDataRow) {
                        try {
                            System.out.println(">>>>>>>>最后一行,空行");
                            CellStyle style2 = cc2.getCellStyle();
                            Font font2 = ((XSSFCellStyle) style2).getFont();
                            short oldsize2 = font2.getFontHeightInPoints();
                            CellStyle styleN4 = wb.createCellStyle();
                            styleN4.cloneStyleFrom(style2);
                            styleN4.setBorderBottom(BorderStyle.valueOf((short) 1));
                            Font fontN4 = wb.createFont();
                            fontN4.setBold(font2.getBold());
                            fontN4.setFontName(font2.getFontName());
                            fontN4.setFontHeightInPoints(oldsize2);
                            styleN4.setFont(fontN4);
                            cc2.setCellStyle(styleN4);
                        } catch (Exception e) {
                            System.out.println(">>>>>>>>最后一行,空行,cc is null");
                        }
                    }
                }
            }
            return wb;
        } catch (IOException e2) {
            throw new RuntimeException("templatePath excel file load error :" + this.ModelFilePath);
        }
    }

    public static int getMergeColumNum(Cell cell, Sheet sheet) {
        int mergeSize = 1;
        int rowIndex = cell.getRowIndex();
        int columnIndex = cell.getColumnIndex();
        Iterator<CellRangeAddress> it = sheet.getMergedRegions().iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            CellRangeAddress cellRangeAddress = it.next();
            if (cellRangeAddress.isInRange(rowIndex, columnIndex)) {
                mergeSize = (cellRangeAddress.getLastColumn() - cellRangeAddress.getFirstColumn()) + 1;
                break;
            }
        }
        return mergeSize;
    }

    public static void removeMergedRegion(Sheet sheet, int row, int column) {
        int sheetMergeCount = sheet.getNumMergedRegions();
        int index = 0;
        for (int i = 0; i < sheetMergeCount; i++) {
            CellRangeAddress ca = sheet.getMergedRegion(i);
            int firstColumn = ca.getFirstColumn();
            int lastColumn = ca.getLastColumn();
            int firstRow = ca.getFirstRow();
            ca.getLastRow();
            if (row == firstRow && column >= firstColumn && column <= lastColumn + 1) {
                index = i;
            }
        }
        sheet.removeMergedRegion(index);
    }
}
